<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('商品库存信息列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>商品名称：</label>
                                <input type="text" name="goodsName"/>
                            </li>
                            <li>
                                <label>仓库名称：</label>
                                <input type="text" name="warehouseName"/>
                            </li>

                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var goodsUnitDatas = [[${@dict.getType('product_unit')}]];
        var prefix = ctx + "store/stock";

        $(function() {
            var options = {
                url: prefix + "/selectList",
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                modalName: "商品库存",
                queryParams: queryParams,
                columns: [{
                    radio: true
                },
                {
                    field: 'id',
                    title: 'id',
                    visible: false
                },
                {
                    field: 'goodsId',
                    title: 'goodsId',
                    visible: false
                },
                {
                    field: 'batchNo',
                    title: '批次'
                },
                {
                    field: 'goodsCode',
                    title: '商品编码'
                },
                {
                    field: 'goodsName',
                    title: '名称'
                },
                {
                    field: 'warehouseName',
                    title: '仓库名称'
                },

                {
                    field: 'goodsUnit',
                    title: '单位',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(goodsUnitDatas, value);
                    }
                },
                {
                    field: 'stockNumber',
                    title: '库存数量',
                }]
            };
            $.table.init(options);
        });

        //新增自带查询参数 仓库主键
        function queryParams(params) {
            var search = {
                warehouseId: $('#warehouseId').val(),
            }
            return search;
        }
    </script>
</body>
</html>